# coding=utf-8
from django.db import models
import datetime

class News(models.Model):
    news_title_en = models.CharField(verbose_name='Title', max_length=63)
    news_title_zh = models.CharField(verbose_name='标题', max_length=31)
    news_content_en = models.TextField(verbose_name='Content', blank=True)
    news_content_zh = models.TextField(verbose_name='内容', blank=True)
    news_datetime = models.DateTimeField(verbose_name='Publish Date', default=datetime.datetime.now())
    news_status = models.BooleanField(verbose_name='Draft', default=False)
    news_cover = models.ImageField(verbose_name='Cover', upload_to='uploads/news', blank=True, max_length=255)

    def __unicode__(self):
        return self.news_title_zh

    class Meta:
        get_latest_by = "news_datetime"
        ordering = ['-news_datetime', '-id']
        verbose_name = "News"
        verbose_name_plural = "News"
